load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

cc_binary(
    name = "libtraffic_light_component.so",
    linkshared = True,
    linkstatic = False,
    deps = [":traffic_light_component_lib"],
)

cc_library(
    name = "traffic_light_component_lib",
    srcs = glob(["*.cc"]),
    hdrs = glob(["*.h"]),
    linkopts = [
        "-pthread -lz -lrt -luuid -ljsoncpp",
    ],
    deps = [
        "//middleware/device_service/proto:traffic_light_service_cc_pb",
        "//middleware/device_service/proto:traffic_light_config_cc_pb",
        "//base/device_connect/traffic_light:traffic_light_device",
        "//base/device_connect/proto:traffic_light_data_cc_pb",
        "@protobuf_import//:protobuf_import",
        "@com_github_google_glog//:glog",
        "@fastrtps//:fastrtps",
        "@com_github_gflags_gflags//:gflags",
        "@airosrt//:airosrt",
        "@yaml_cpp//:yaml_cpp",
    ],
    copts = [
        "-DUSE_CYBERRT",
        "-DMODULE_NAME=\\\"traffic_light_service\\\""
    ]
)

cc_test(
    name="traffic_light_service_ut",
    srcs = ["ut/traffic_light_service_component_test.cc"],
    linkopts = [
        "-pthread -lz -lrt -luuid",
    ],
    deps=[
        "@com_google_googletest//:gtest_main",
        ":traffic_light_component_lib"
    ],
    copts = [
        "-DUSE_CYBERRT"
    ]
)